package com.cd2cd.code_template.code_template.mapper;

import com.cd2cd.code_template.code_template.mapper.gen.SuperSysGroupMapper;
import org.apache.ibatis.annotations.*;

@Mapper
public interface SysGroupMapper extends SuperSysGroupMapper {

    /**
     * 逻辑删除用户组
     * @param id
     * @param i
     * @return
     */
    @Update("update sys_group set del_flag=#{delFlag} where id=#{id}")
    Integer updateDelFlagById(@Param("id") Integer id,  @Param("delFlag") Integer i);

    @Select("select count(1) from sys_user where del_flag = 'ok' and id in (select user_id from sys_relation_user where type = 'group' and id = #{groupId})")
    @ResultType(Integer.class)
    int haveRelation(@Param("groupId") Integer groupId);
}